package com.my.hp_hr.util;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter("/*")
public class MyFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest sr, ServletResponse srp, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) sr;
        HttpServletResponse resp = (HttpServletResponse) srp;
        sr.setCharacterEncoding("utf-8");
        srp.setContentType("text/html;charset=utf-8");
        srp.setCharacterEncoding("utf-8");
        filterChain.doFilter(req,resp);

    }

    @Override
    public void destroy() {

    }
}
